<?=$this->form_eksternal->form_open("", '', 
                      array("id_detail" => $detail[0]->id_actifity_report))?>
<div id="main-content">
  <div class="container-fluid">
    <div class="row-fluid">
      <div class="span12">
        <div class="widget-block">
          <?php
          if($message == 'filed'){
          ?>
          <div class="alert alert-error fade in">
            <button data-dismiss="alert" class="close" type="button">×</button>
            <strong>Filed!</strong> Fail to save data.
          </div>
          <?php
          }
          if($message == 'sukses'){
          ?>
          <div class="alert alert-success fade in">
            <button data-dismiss="alert" class="close" type="button">×</button>
            <strong>Success!</strong> Now you have new user.
          </div>
          <?php
          }
          ?>
          <div class="widget-head">
            <h5><?=$title_table?></h5>
            <div class="widget-control pull-right">
              <a href="#" data-toggle="dropdown" class="btn dropdown-toggle"><i class="icon-cog"></i><b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="<?=  site_url("outlet/aktifitas/detail/".$detail[0]->id_actifity_report) ?>"><i class="icon-plus"></i> Report Detail</a></li>
                <li><a href="<?=  site_url("outlet/aktifitas/history/".$detail[0]->id_actifity_report) ?>"><i class="icon-plus"></i> PICA</a></li>
<!--                <li><a href="#"><i class="icon-ok"></i> Active</a></li>
                <li><a href="#"><i class="icon-minus-sign"></i> No-Active</a></li>
                <li><a href="#"><i class="black-icons pdf_document"></i> Export to PDF</a></li>-->
                <li><a href="<?=  site_url("outlet/aktifitas/history-exels/".$detail[0]->id_actifity_report) ?>"><i class="black-icons excel_document"></i> Export to XLS</a></li>
              </ul>
            </div>
          </div>
          <div class="widget-content">
            <div class="widget-box">
              <table id="table_pica" class="table">
                <thead>
                  <tr>
                    <th>Create By</th>
                    <th>Problem Identification</th>
                  </tr>
                </thead>
                <?php
                $data_hasil = "";
                if(is_array($data)){
                  $no = 1;
                  foreach($data as $dt){
                    if(!$dt->problem){
                      $dt->problem = $this->form_eksternal->form_edit_textarea("problem_".$no, site_url("outlet/aktifitas/pica-edit/{$dt->id_pica}"), 
                              "Enter suggest", "type : 'textarea', rows : 3, cols : 10, submit    : 'OK', 
                              callback : function(value, settings) {sign_user('author_problem_{$dt->id_pica}')}");
                    }
                    $data_hasil = "
                      <tr>
                        <td><div id='author_problem_{$dt->id_pica}'>".
                                $this->global_models->get_field("m_users", "name", array("id_users" => $dt->id_users_problem))."
                            </div>
                            <div id='create_date'>".date('d M Y', strtotime($dt->create_date))."</div>
                        </td>   
                        <td>{$dt->problem}</td>
                      </tr>";
                    $no++;
                    $pic_users = "";
                    $tanggal_dou_date = "";
                    print $data_hasil;
                  }
                }
                ?>
                <tbody id="body_pica">
                </tbody>
                <tfoot style="background-color: gainsboro">
                  <tr>
                    <td colspan="2">
                      <a onclick="add_row_tambahan_sementara('table_pica', '<?=site_url("outlet/aktifitas/add_pica")?>', 'body_pica', 'param')" class="btn"><i class="black-icons create_write"></i>Add New</a>
                      <button id="sub_pica" class="btn btn-primary" type="submit" style="display: none">Save</button>
                    </td>
                  </tr>
                </tfoot>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</form>
<script>
  function add_row_tambahan_sementara(table_pica, site_url, body_pica, param){
    $("#sub_pica").show();
    add_row_tambahan(table_pica, site_url, body_pica, param);
  }
  function sign_user(id){
    $("#"+id).text('<?=$this->session->userdata('name')?>');
  }
  function check(id){
    $("#"+id).show();
  }
  function check(id){
    $("#"+id).show();
  }
</script>